<?php
/*
	插件概览
*/
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'get';
$plugin_name = $_RQ['basicname'] ? $_RQ['basicname'] : '';
if($_RQ['op']=='get'){
	//显示统计数据
		$daytime = mktime(0,0,0,date('m'),date('d'),date('Y'));
		$mounthtime =  mktime(0,0,0,date('m'),1,date('Y'));
		$access=array();
		$access['wechat_day']=pdo_count('jy_shopworker_orderlog',array('uniacid'=>$_SESSION['uniacid'],'status'=>0,'createtime >'=>$daytime));
		$access['wxapp_day']=pdo_count('jy_shopworker_orderlog',array('uniacid'=>$_SESSION['uniacid'],'status'=>1,'createtime >'=>$daytime));
		$access['mobile_day']=pdo_count('jy_shopworker_orderlog',array('uniacid'=>$_SESSION['uniacid'],'status'=>2,'createtime >'=>$daytime));
		$access['pc_day']=pdo_count('jy_shopworker_feelog',array('uniacid'=>$_SESSION['uniacid'],'status'=>0,'createtime >'=>$daytime));
		$access['app_day']=pdo_count('jy_shopworker_feelog',array('uniacid'=>$_SESSION['uniacid'],'status'=>1,'createtime >'=>$daytime));
		$access['all_day']=pdo_count('jy_shopworker_feelog',array('uniacid'=>$_SESSION['uniacid'],'status'=>4,'createtime >'=>$daytime));
		$access['wechat_all']=pdo_count('jy_shopworker_orderlog',array('uniacid'=>$_SESSION['uniacid'],'status'=>0));
		$access['wxapp_all']=pdo_count('jy_shopworker_orderlog',array('uniacid'=>$_SESSION['uniacid'],'status'=>array(1,3)));
		$access['mobile_all']=pdo_count('jy_shopworker_orderlog',array('uniacid'=>$_SESSION['uniacid'],'status'=>2));
		$access['pc_all']=pdo_count('jy_shopworker_feelog',array('uniacid'=>$_SESSION['uniacid'],'status'=>0));
		$access['app_all']=pdo_count('jy_shopworker_feelog',array('uniacid'=>$_SESSION['uniacid'],'status'=>array(1,3)));
		$access['all_all']=pdo_count('jy_shopworker_feelog',array('uniacid'=>$_SESSION['uniacid'],'status'=>4));
		//月份
		for($i=0;$i<12;$i++){
				if($i==0){
					$yuestart = mktime(0,0,0,date('m'),1,date('Y'));
					$yueend = time();
					
				}else{
					$yuestart = mktime(0,0,0,date('m')-$i,1,date('Y'));
					$yueend = mktime(0,0,0,date('m')-$i+1,1,date('Y'));
				}
				$params=array('uniacid'=>$_SESSION['uniacid'],'status'=>array(0,1));
				$params['createtime between']=array($yuestart,$yueend);
				$month12[$i] = date('Y-m',strtotime('-'.$i.' month'));
				//$monthaccess[]=pdo_count('jy_shopworker_orderlog',$params);
				$accessline[$i]=pdo_count('jy_shopworker_orderlog',$params);
				//$monthcredit2[]=pdo_getsum('core_members',$params,'credit2');
		}
		$accessline=array_reverse($accessline);
		$month12=array_reverse($month12);
		$return['htmls']=array(
				array('type'=>'data','one_num'=>2,'title'=>'应用今日/总数据指标','datas'=>array(
					array('title'=>'待审核业绩','num'=>2,'data'=>array($access['wechat_day'],$access['wechat_all'])),
					array('title'=>'已审核业绩','num'=>2,'data'=>array($access['wxapp_day'],$access['wxapp_all'])),
					array('title'=>'审核不通过业绩','num'=>2,'data'=>array($access['mobile_day'],$access['mobile_all'])),
					array('title'=>'待审核薪资','num'=>2,'data'=>array($access['pc_day'],$access['pc_all'])),
					array('title'=>'待发放新增','num'=>2,'data'=>array($access['app_day'],$access['app_all'])),
					array('title'=>'已发放新增','num'=>2,'data'=>array($access['all_day'],$access['all_all'])),
				)),
				array('type'=>'echarts_arealine','ecid'=>'mobile','title'=>'月度业绩数据','datas'=>array(
					'datas'=>array(
						array('name'=>'业绩','value'=>$accessline),
					),
					'xdatas'=>$month12,
				)),
		);
	exi($return);
}